package com.acme.bankapp.service.bank;

import java.util.LinkedList;
import java.util.List;

public class Queue {
    private List<Email> list = new LinkedList<>();

    public boolean isEmpty = true,
            isClosed = false;

    public void add(Email email) {
        if (isClosed) {
            return;
        }
        list.add(email);
        isEmpty = false;
    }

    public void remove() {

        Email email;

        email = list.get(0);
        System.out.printf("\nEmail sended from Queue\n Client: %s, to email: %s", email.client.fio, email.emailAddress);
        list.remove(0);
        isEmpty = (list.size() == 0);


    }
}
